package com.wow.app.dal.impl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.wow.app.dal.PageDAO;
import com.wow.app.dal.dto.PageDO;

public class PageDAOImpl extends SqlMapClientDaoSupport implements PageDAO {

	@Override
	public int addPage(PageDO pageDO) {
		return (Integer) this.getSqlMapClientTemplate().insert("page.add_page",
				pageDO);
	}

	@Override
	public void updatePage(PageDO pageDO) {
		this.getSqlMapClientTemplate().update("page.update_page", pageDO);
	}

	@Override
	public PageDO getPageById(int id) {
		return (PageDO) this.getSqlMapClientTemplate().queryForObject(
				"page.query_page_by_id", id);
	}

	@Override
	public void deletePageById(int id) {
		this.getSqlMapClientTemplate().delete("page.delete_page_by_id", id);
	}

	@Override
	public List<PageDO> getPageListByOwnerId(String ownerId) {
		return this.getSqlMapClientTemplate().queryForList("page.get_page_list_by_owner",ownerId);
	}

}
